<template>
  <div>
    <div class="tab-control">
      <div
        @click="itemClick(index)"
        :class="currentIndex == index ? 'active' : ''"
        class="item"
        v-for="(item, index) in title"
        :key="index"
      >
        <span>{{ item }}</span>
      </div>
    </div>
  </div>
</template>

<script>
// import TabControl from "@/components/tabcontrol/TabControl";
export default {
  components: {
    // TabControl,
  },
  data() {
    return {
      title: ["综合", "价格", "分类"],
      currentIndex: 0,
    };
  },
  methods: {
    itemClick(index) {
      // console.log(index);
      this.currentIndex = index;
      this.$emit('tabControlClick', this.currentIndex)
    },

  },
};
</script>

<style lang="scss" scoped>
.tab-control {
  display: flex;
  height: 44px;
  line-height: 44px;
  text-align: center;
  background-color: #fff;
  .item {
    flex: 1;
  }
  .active {
    color: #f00;
  }
}
</style>